import axios from '../../utils/sphRequest'
// 登录
export const reqUserLogin = (user) => axios.post('/user/passport/login', user)


// 添加商品到购物车或是在购物车中更改商品数量
export const reqAddOrUpdataSkuInfoToShopCart = (skuId, skuNum) => axios.post(`/cart/addToCart/${skuId}/${skuNum}`)
// 获取购物车数据
export const reqGetSkuInfoToShopCart = () => axios.get(`/cart/cartList`)
// 单选中/不选中
export const reqChangeShopCartInfoState = (skuID, isChecked) => axios.get(`/cart/checkCart/${skuID}/${isChecked}`)
// 全选/全不选
export const reqChangeAllCartState = (isChecked, skuIdlist) => axios({
  url: `/cart/batchCheckCart/${isChecked ? 1 : 0}`,
  method: 'post',
  data: skuIdlist
})
// 删除单个商品
export const reqDelOneShopCartInfo = (skuId) => axios.delete(`/cart/deleteCart/${skuId}`)
// 12. 批量删除商品
export const reqDelSelectedCartInfo = (selectedObj) => axios.post(`/cart/batchDeleteCart`, selectedObj)
// 获取用户地址信息
export const reqUserAddressList = () => axios.get('/user/userAddress/auth/findUserAddressList')
// 订单结算中心接口函数
export const reqGetTradeInfoData = () => axios.get('/order/auth/trade')
// 提交订单
export const reqSubmitOrder = (tradeNo, params) => axios.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, params)
// 订单支付信息
export const reqGetPayQRcode = (orderId) => axios.get(`/payment/weixin/createNative/${orderId}`)
// 支付状态查询
export const reqGetPayState = (orderId) => axios.get(`/payment/weixin/queryPayStatus/${orderId}`)
// 查询订单中心列表(已经支付过钱的列表)
export const reqGetCenterListData = (page, limit) => axios.get(`/order/auth/${page}/${limit}`)

